package com.wang.seckill.controller;

import com.wang.seckill.rabbitmq.MQSender;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class RabbitMQController {

    @Resource
    private MQSender mqSender;

    @RequestMapping("/mq")
    @ResponseBody
    public void mq() {
        mqSender.send("hello, world");
    }

    @RequestMapping("/mq/fanout")
    @ResponseBody
    public void fanout() {
        mqSender.sendFanout("hello, jack");
    }

    @RequestMapping("/mq/topic01")
    @ResponseBody
    public void topic01() {
        mqSender.sendTopic01("hello, abc");
    }

    @RequestMapping("/mq/topic02")
    @ResponseBody
    public void topic02() {
        mqSender.sendTopic02("hello, leiyang");
    }

}
